package com.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.crm.domain.Contract;
import com.crm.dto.CluesStatisticsListDto;
import com.crm.dto.CommonStatisticsPageQueryDto;
import com.crm.dto.ContractStatisticsPageQueryDto;
import com.crm.dto.Vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface StatsMapper extends BaseMapper<Contract> {

    Page<Contract> selectAll(Page<Contract> page,@Param("dto") ContractStatisticsPageQueryDto dto);
    /**
     * 查询开始日期之前的客户总数
     */
    @Select("select count(*) from contract where create_time < #{beginDateTime}")
    int getBeginDataTotalCustomers(LocalDateTime beginDateTime);

    List<DetailDataVO> getDetailData(LocalDateTime beginDateTime, LocalDateTime endDateTime, LocalDate beginCreateTime, LocalDate endCreateTime);

    Page<OwnerShipStatisticsVo> selectDeptPage(Page<OwnerShipStatisticsVo> page,@Param("dto") CommonStatisticsPageQueryDto dto);

    List<SubjectStatisticsVo> getSubjectStatistics(LocalDateTime beginDateTime, LocalDateTime endDateTime);

//    Page<CluesStatisticsVo> selectCluesPage(Page<CluesStatisticsVo> cluePage, @Param("dto") CluesStatisticsListDto dto);
}
